Skip to content

Adjust how native static libraries are linked #40504

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

retep998
Copy link
Member

@retep998 retep998 commented Mar 14, 2017

Switch from link_whole_staticlib to link_staticlib because we now pass explicit lists of what to export to the linker on all platforms so theoretically it should work.
Ensure that hint_static is used appropriately for all static libraries, including static-nobundle, not just static.

r? @alexcrichton
cc @vadimcn

// functions, etc.
cmd.link_whole_staticlib(&l.name.as_str(), &search_path);
}
}).collect::<Vec<_>>();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason for the collect?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really, so I removed it.

@retep998
Copy link
Member Author

Hmmmm, it looks like linking the whole staticlib is still necessary for librustc_llvm.

@alexcrichton
Copy link
Member

Oh right, I don't think we past a list of symbols when creating dylibs on Unix platforms (only on Windows). For cdylibs I think we past the list on all platforms.

@vadimcn
Copy link
Contributor

vadimcn commented Mar 14, 2017

Any reason to not always use an explicit export list? Are there linkers that do not support them?

@alexcrichton
Copy link
Member

Unsure, if we can get it to work then we can get it to work. Very little of src/librustc_trans/back/*.rs is anything beyond "this was the first thing that landed"

@alexcrichton
Copy link
Member

ping @retep998, any update on this?

@retep998
Copy link
Member Author

#40805 does the changes to hinting in a way which I think is better. It doesn't however attempt to switch from whole_staticlib to simply staticlib, so I'll investigate whether it is possible to use an explicit export list for dylibs everywhere.

@alexcrichton
Copy link
Member

Ok, in the meantime I'm going to close this, but we can reopen/resubmit when tests are passing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants